<?php

namespace IDock\Insurance\ACIC\Response\NonCar;

use IDock\Http\Response;
use IDock\Insurance\ACIC\Response\AllACICResponse;
use IDock\Printer\NonCar\NonCarProductListPrinter;
use IDock\Printer\NonCar\NonCarProductPrinter;
use IDock\Printer\NonCar\NonCarSubCoveragePrinter;

class NonCarProductListResponse extends AllACICResponse
{
    public $seats = '';

    public function printerInit(): Response
    {
        $this->printer = new  NonCarProductListPrinter();
        $list = [
            [
                'productCode' => '0607_05_01',
                'productName' => '',
                'planCode' => '',
                'planName' => '2023四川15万5座(168元)',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '120',
                        'amount' => '150000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '30',
                        'amount' => '150000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065515',
                        'subName' => '附加个人意外伤害住院津贴保险',
                        'premium' => '18',
                        'amount' => '100',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '066400014',
            ],
            //[
            //    'productCode' => '0607_05_02',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '2023四川30万5座(336元)',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '250',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '50',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065515',
            //            'subName' => '附加个人意外伤害住院津贴保险',
            //            'premium' => '36',
            //            'amount' => '100',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            //[
            //    'productCode' => '0607_05_03',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '2023四川50万5座(556元)',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '400',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '100',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065515',
            //            'subName' => '附加个人意外伤害住院津贴保险',
            //            'premium' => '56',
            //            'amount' => '100',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            //[
            //    'productCode' => '0607_07_01',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '2023四川15万7座(188元)',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '120',
            //            'amount' => '150000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '30',
            //            'amount' => '150000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065515',
            //            'subName' => '附加个人意外伤害住院津贴保险',
            //            'premium' => '38',
            //            'amount' => '100',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            //[
            //    'productCode' => '0607_07_02',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '2023四川30万7座(376元)',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '250',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '50',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065515',
            //            'subName' => '附加个人意外伤害住院津贴保险',
            //            'premium' => '76',
            //            'amount' => '100',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            //[
            //    'productCode' => '0607_07_03',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '2023四川50万7座(628元)',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '400',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '128',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065515',
            //            'subName' => '附加个人意外伤害住院津贴保险',
            //            'premium' => '100',
            //            'amount' => '100',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            [
                'productCode' => '0676_05_01_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(78元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '50',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '10000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '20',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600016',
            ],
            [
                'productCode' => '0676_05_02_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(158元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '100',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '20000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '50',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600020',
            ],
            [
                'productCode' => '0676_05_03_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(235元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '150',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '15',
                        'amount' => '30000',
                        'rate' => '',
                        'NoDuctAmt' => '100'
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '70',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600024',
            ],
            [
                'productCode' => '0676_05_04_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(350元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '220',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '30',
                        'amount' => '50000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '100',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600028',
            ],

            [
                'productCode' => '0676_07_01_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧7座(118元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '70',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '10000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '40',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600018',
            ],

            [
                'productCode' => '0676_07_02_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧7座(236元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '140',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '16',
                        'amount' => '20000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '80',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600022',
            ],

            [
                'productCode' => '0676_07_03_A1',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧7座(358元)-A1款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '200',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '30000',
                        'rate' => '',
                        'NoDuctAmt' => '100'
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '150',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600026',
            ],

            //[ //暂无
            //    'productCode' => '0676_07_04_A1',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '驾乘无忧7座(580元)-A1款',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '200',
            //            'amount' => '500000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '8',
            //            'amount' => '50000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '060055',
            //            'subName' => '附加法定节假日意外伤害保险',
            //            'premium' => '150',
            //            'amount' => '500000',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            [
                'productCode' => '0676_05_01_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(98元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '70',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '10000',
                        'rate' => '',
                        'NoDuctAmt' => '100',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '20',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600017'
            ],
            [
                'productCode' => '0676_05_02_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(218元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '150',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '8',
                        'amount' => '20000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '60',
                        'amount' => '200000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600021'
            ],
            [
                'productCode' => '0676_05_03_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(328元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '200',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '28',
                        'amount' => '30000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '100',
                        'amount' => '300000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600025'
            ],
            [
                'productCode' => '0676_05_04_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧5座(550元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '200',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '30',
                        'amount' => '50000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '320',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600029'
            ],
            [
                'productCode' => '0676_07_01_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧7座(140元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '90',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '10',
                        'amount' => '10000',
                        'rate' => '',
                        'NoDuctAmt' => '100'
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '40',
                        'amount' => '100000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600019'
            ],
            //[   //暂无 318
            //    'productCode' => '0676_07_02_A2',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '驾乘无忧7座(318元)-A2款',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '90',
            //            'amount' => '200000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '10',
            //            'amount' => '20000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '060055',
            //            'subName' => '附加法定节假日意外伤害保险',
            //            'premium' => '40',
            //            'amount' => '200000',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            //[   //暂无 468
            //    'productCode' => '0676_07_03_A2',
            //    'productName' => '',
            //    'planCode' => '',
            //    'planName' => '驾乘无忧7座(468元)-A2款',
            //    'coverageList' => [
            //        [
            //            'subCode' => '067601',
            //            'subName' => '驾乘人员意外伤害保险',
            //            'premium' => '90',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '065514',
            //            'subName' => '附加个人意外伤害医疗保险',
            //            'premium' => '10',
            //            'amount' => '30000',
            //            'rate' => '',
            //        ],
            //        [
            //            'subCode' => '060055',
            //            'subName' => '附加法定节假日意外伤害保险',
            //            'premium' => '40',
            //            'amount' => '300000',
            //            'rate' => '',
            //        ],
            //    ],
            //],
            [
                'productCode' => '0676_07_04_A2',
                'productName' => '',
                'planCode' => '',
                'planName' => '驾乘无忧7座(780元)-A2款',
                'coverageList' => [
                    [
                        'subCode' => '067601',
                        'subName' => '驾乘人员意外伤害保险',
                        'premium' => '500',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '065514',
                        'subName' => '附加个人意外伤害医疗保险',
                        'premium' => '30',
                        'amount' => '50000',
                        'rate' => '',
                    ],
                    [
                        'subCode' => '060055',
                        'subName' => '附加法定节假日意外伤害保险',
                        'premium' => '250',
                        'amount' => '500000',
                        'rate' => '',
                    ],
                ],
                'FreeID' => '067600031'
            ],

        ];

        foreach ($list as $item) {
            $amount = $premium = '0';
            $productPrinter = new NonCarProductPrinter();
            $productPrinter->productCode = $item['productCode'] ?? '';//产品编码
            $productPrinter->productName = $item['productName'] ?? '';//产品名称
            $productPrinter->productType = '驾意险';
            $productPrinter->productDesc = '';
            $productPrinter->planCode = $item['planCode'] ?? '';//方案代码
            $productPrinter->planName = $item['planName'] ?? '';//方案名称
            $productPrinter->argc['FreeID'] = $item['FreeID'] ?? ''; //费用ID

            //$productPrinter->maxQuantity = $this->seats;//最大购买份数
            $productPrinter->maxQuantity = 1;//最大购买份数

            foreach ($item['coverageList'] ?? [] as $sub) {
                $subCoverage = new NonCarSubCoveragePrinter();
                $subCoverage->subCode = $sub['subCode'] ?? '';
                $subCoverage->subName = $sub['subName'] ?? '';
                $subCoverage->amount = $sub['amount'] ?? '0';
                $subCoverage->premium = $sub['premium'] ?? '';
                $subCoverage->argc['NoDuctAmt'] = $sub['NoDuctAmt'] ?? '';
                $subCoverage->argc['FreeID'] = $item['FreeID'] ?? '';

                $amount += $subCoverage->amount;
                $premium += $subCoverage->premium;

                $productPrinter->subCoverageAppend($subCoverage);
            }
            $productPrinter->unitAmount = (string)$amount;
            $productPrinter->premium = (string)$premium;

            $this->printer->productListAppend($productPrinter);
        }

        return $this;
    }
}
